<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateQiiSearchModelArchivesTable extends Migration
{
    /**
     * Schema table name to migrate
     * @var string
     */
    public $set_schema_table = 'qii_search_model_archives';

    /**
     * Run the migrations.
     * @table qii_search_model_archives
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable($this->set_schema_table)) return;
        Schema::create($this->set_schema_table, function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id')->comment('主键');
            $table->unsignedInteger('ikey')->default('0')->comment('检索目标主键');
            $table->string('title_zh')->default('')->comment('中文标题');
            $table->string('title_en')->default('')->comment('英文标题');
            $table->unsignedBigInteger('sortrank')->nullable()->default('0')->comment('排序');
            $table->unsignedBigInteger('category_id')->nullable()->default('0')->comment('栏目id');

            $table->unique(["ikey"], 'ikey');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
     public function down()
     {
       Schema::dropIfExists($this->set_schema_table);
     }
}
